public class test1 {
    static class ListNode{
        public int val;
        public ListNode next;
        //构造方法
        public ListNode(int val){
            this.val=val;
        }
        public int size(){
            ListNode cut=head;
            int size=0;
           while (cut!=null){
               size++;
               cut=cut.next;
           }
            return size;
        }
        public boolean contain(int key){
            ListNode cut=head;
            while (cut!=null){
                cut=cut.next;
                if(cut.val==key){
                    return true;
                }
            }
            return false;
        }
        public void addLast(int data){
            ListNode Node=new ListNode(data);
            ListNode cut=head;
            while (cut!=null){
                cut=cut.next;
                }
            cut=Node;
            }
        }

    public static ListNode head;//表示链表的头节点

    public static void main(String[] args) {

    }
}
